﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Yahoo.Yui.Compressor;

namespace CSSMixer
{
    public class CssCompressor:CssActionBase
    {
        public string Compress()
        {
            StringBuilder cssBuilder = new StringBuilder();

            foreach (string cssPath in CSSFiles)
            {
                StreamReader streamReader = new StreamReader(cssPath);
                cssBuilder.AppendLine(streamReader.ReadToEnd());
                streamReader.Close();
            }

            return Compress(cssBuilder.ToString());
        }
        public string Compress(string css)
        {
            if (string.IsNullOrEmpty(css))
                return string.Empty;

            return Yahoo.Yui.Compressor.CssCompressor.Compress(css,73,CssCompressionType.Hybrid);
        }
    }
}
